package com.hgq.tenadmin.md.market.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hgq.tenadmin.md.market.dao.MdMarketDao;
import com.hgq.tenadmin.md.market.service.MdMarketService;
import com.hgq.tencommon.entity.md.market.MdMarket;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class MdMarketServiceImpl implements MdMarketService {
    @Resource
    private MdMarketDao mdMarketDao;

    @Override
    public PageInfo<MdMarket> findAllMdMarket(int pageNum,int pageSize,Integer source, Integer follow) {
        PageHelper.startPage(pageNum,pageSize);
        List<MdMarket> mdMarkets = mdMarketDao.selectAllMarket(source, follow);
        PageInfo<MdMarket> mdMarketPageInfo = new PageInfo<>(mdMarkets);
        return mdMarketPageInfo;
    }

    @Override
    public void saveOneMarket(MdMarket market) {
         mdMarketDao.insertOneMarket(market);
    }

    @Override
    public void updateOneMarket(MdMarket market) {
        mdMarketDao.updateOneMarket(market);
    }

    @Override
    public void removeOneMarket(Integer mid) {
        mdMarketDao.deleteOneMarket(mid);
    }
}
